{% extends 'index/base.html' %}

{% block title %}订阅管理{% endblock %}

{% block content %}
    <section class="pt-5">
        <div class="wow fadeIn">
          <h2 class="h1 text-center mb-5">订阅管理中心</h2>
          <p class="text-center mb-5 pb-5">Polymer有丰富的订阅内容，你可以根据自己的喜好选择显示在首页上的订阅。</p>
        </div>

        {% for each in current_user.subscription %}
        <div class="row mt-3 wow fadeIn">
          <div class="col-lg-5 col-xl-4 mb-4">
            <div class="view overlay rounded z-depth-1">
              <img src="{{ url_for('poly.get_cover', filename=each.subscribed.image) }}"  width="350" height="180"
                alt="">
              <a href="{{ url_for('poly.detail', crawler_id=each.subscribed.id) }}" target="_blank">
                <div class="mask rgba-white-slight"></div>
              </a>
            </div>
          </div>
          <div class="col-lg-7 col-xl-7 ml-xl-4 mb-4">
            <h3 class="mb-3 font-weight-bold dark-grey-text">
              <strong>{{ each.subscribed.name }}</strong>
            </h3>
            <p class="grey-text">{{ each.subscribed.describe }}</p>
            <div>
                <a href="{{ url_for('poly.detail', crawler_id=each.subscribed.id) }}" target="_blank"
                  class="btn btn-primary btn-md" style="display:inline-block">查看详情
                  <i class="fas fa-info ml-2"></i>
                </a>
                <form method="post" action="{{ url_for('user.sub_delete', crawler_id=each.subscribed.id) }}" style="display:inline-block">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
                    <button class="btn btn-outline-primary btn-md waves-effect waves-light" type="submit">取消订阅<i class="fas fa-trash ml-2"></i></button>
                </form>
            </div>
          </div>
        </div>
        <hr class="mb-5">
        {% endfor %}
    </section>
{% endblock %}
